package ConditionPackage;

import SquarePackage.Rock;
import SquarePackage.Square;
import SquarePackage.Temperature;

public class RockCondition implements Condition {


	private Temperature temperature;
	private Class<? extends Square> ClassParameter;
	/**
	 * default constructor with checking class Rock en minimum Temperature 200
	 */
	public RockCondition(){
		this(new Temperature(200), Rock.class);
	}
	/**
	 * you can specify temperature, and a specific Square type
	 * @param Temperature this specifies a minimum temperature
	 * @param parameterClass this specifies a Type of Squares
	 */
	public RockCondition(Temperature Temperature, Class<? extends Square> parameterClass){
		setTemperature(Temperature);
		setClass(parameterClass);
		setValue(1);
	}
	/**
	 * this is the condition checker
	 * @return True if and only if both conditions(a minimum, maximum or equal) Temperature value, and A Specific class type
	 */
	@Override
	public boolean checkCondition(Square object) {
		if(ClassParameter.isInstance(object) && object.getTemperature().compareTo(temperature)==value)
			return true;
		else
			return false;
	}
	/**
	 * usd to change the class parameter for this dungeon
	 * @param classparam the class of Squares you want
	 */
	public void setClass(Class classparam){
		this.ClassParameter = classparam;
	}
	/**
	 * use to change the Temperature which is compared to 
	 * @param Temperature the Temperature object to compare with
	 */
	public void setTemperature(Temperature Temperature){
		this.temperature = Temperature;
	}
	private int value;
	/**
	 * Specifies the fact if we want equals, larger or smaller than
	 * -1= < 
	 * 0 = equals
	 * 1 = >
	 * @param value
	 */
	public void setValue(int value) {
		this.value = value;
	}
}
